<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/3/11
  Time: 17:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page isELIgnored="false" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
    <title>查看学生信息</title>
    <style>
        .but{
            height: 22px;
            width:70px;
            cursor:pointer;
            background-color: rgb(0,150,136);
            display: inline-block;
            text-align: center;
            color: white;
        }
        .username{
            width: 150px;
            height: 20px
        }
    </style>
</head>
<body>
<div>
    请输入微信网名：<input type="text" id="username" class="username">
    请输入学生姓名：<input type="text" id="realName" class="username">
    <div type="button" class="but" onclick="getTable()">搜索</div>
</div>
<table class="layui-hide" id="demo" lay-filter="test"></table>


<script type="text/javascript" src="${path}/webapp/js/layui-public.js"></script>
<script type="text/javascript">
    function getTable() {
        var table = layui.table //表格
        var username=$("#username").val();
        var realName=$("#realName").val();
        //执行一个 table 实例
        table.render({
            elem: '#demo'
            ,where: {'username':username,'realName':realName}//传值
            ,method: 'post'//请求方式
            ,height: 420
            ,url: '${path}/sys/student/getStudent' //数据接口
            ,title: '用户表'
            ,page: true //开启分页
            ,toolbar: true //开启工具栏，此处显示默认图标，可以自定义模板，详见文档
            ,totalRow: true //开启合计行
            ,cols: [[ //表头
                {type: 'checkbox', fixed: 'left'}
                ,{field: 'id', title: 'ID', width:80, sort: true, fixed: 'left'}
                ,{field: 'nickName', title: '微信昵称', width:80}
                ,{field: 'gender', title: '性别', width:80,templet:'#gender'}
                ,{field: 'city', title: '所在城市', width:80}
                ,{field: 'realName', title: '姓名', width:80}
                ,{field: 'phoneNumber', title: '电话', width:80}
                ,{field: 'createTime', title: '第一次访问', width:80}
                ,{field: 'updateTime', title: '最后一次访问', width:80}
                ,{field: 'loginCecond', title: '访问次数', width:80}
            ]]
        });
    }
</script>
<%--判断性别--%>
<script type="text/html" id="gender">
    {{#  if(d.gender==1){ }}
    <span>男</span>
    {{#  } }}
    {{#  if(d.gender==2){ }}
    <span>女</span>
    {{#  } }}
    {{#  if(d.gender==0){ }}
    <span>未知</span>
    {{#  } }}
</script>
</body>
</html>
